
Public Class Dataprovider
    Public Shared Sub ExecuteNonQuery(ByVal s As String)
        Dim cnn As OleDb.OleDbConnection = New OleDb.OleDbConnection()
        cnn.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=QLKS.mdb"
        cnn.Open()
        Dim com As OleDb.OleDbCommand = New OleDb.OleDbCommand(s, cnn)
        Try
            com.ExecuteNonQuery()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        cnn.Close()
    End Sub
    Public Shared Function ExecuteScalar(ByVal s As String) As String
        Dim kq As String = ""
        Dim cnn As OleDb.OleDbConnection = New OleDb.OleDbConnection()
        cnn.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=QLKS.mdb"
        cnn.Open()
        Dim com As OleDb.OleDbCommand = New OleDb.OleDbCommand(s, cnn)
        Try
            kq = (com.ExecuteScalar())
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        'cnn.Close()
        Return kq
    End Function
    Public Shared Function ExecuteReader(ByVal s As String) As OleDb.OleDbDataReader
        Dim kq As OleDb.OleDbDataReader
        Dim cnn As OleDb.OleDbConnection = New OleDb.OleDbConnection()
        cnn.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=QLKS.mdb"
        cnn.Open()
        Dim com As OleDb.OleDbCommand = New OleDb.OleDbCommand(s, cnn)
        Try
            kq = com.ExecuteReader()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        'cnn.Close()
        Return kq
    End Function
End Class
